#include "CRecordInfo.h"

CRecordInfo::~CRecordInfo()
{
}
CRecordInfo::CRecordInfo()
{
	_nOPIndex = 0;
	_opDesc = "";
}
CRecordInfo::CRecordInfo(const CRecordInfo& other)
{
	_nOPIndex = other._nOPIndex;
	_opDesc = other._opDesc;
	_vecRecordItems.clear();
    for (size_t i = 0; i < other._vecRecordItems.size(); ++i)
	{
		_vecRecordItems.push_back(other._vecRecordItems[i]);
	}
}
CRecordInfo& CRecordInfo::operator=(const CRecordInfo& other)
{
	_nOPIndex = other._nOPIndex;
	_opDesc = other._opDesc;
	_vecRecordItems.clear();
    for (size_t i = 0; i < other._vecRecordItems.size(); ++i)
	{
		_vecRecordItems.push_back(other._vecRecordItems[i]);
	}
	return *this;
}
void CRecordInfo::SetOpIndex(int nIndex)
{
	_nOPIndex = nIndex;
}
void CRecordInfo::SetOpDesc(CLComString desc)
{
	_opDesc = desc;
}
void CRecordInfo::AddRecordItem(CRecordItem& item)
{
	_vecRecordItems.push_back(item);
}
int CRecordInfo::GetOpIndex()
{
	return _nOPIndex;
}
CLComString CRecordInfo::GetOpDesc()
{
	return _opDesc;
}
bool CRecordInfo::GetItem(CRecordItem& outItem, int nIndex)
{
    if (nIndex < 0 || nIndex >= (int)_vecRecordItems.size())
	{
		return false;
	}
	outItem = _vecRecordItems[nIndex];

	return true;
}
